package com.toycloud.common.excel.converter;

import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.data.WriteCellData;
import com.alibaba.excel.metadata.property.ExcelContentProperty;

public class ReadConverter implements Converter<String> {

    @Override
    public Class<String> supportJavaTypeKey() {
        return String.class;
    }

    @Override
    public WriteCellData<?> convertToExcelData(String value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
        if ("0".equals(value)) {
            return new WriteCellData<>("未标记");
        } else if ("1".equals(value)) {
            return new WriteCellData<>("很重要");
        } else if ("2".equals(value)) {
            return new WriteCellData<>("一般重要");
        } else if ("3".equals(value)) {
            return new WriteCellData<>("不重要");
        } else {
            return new WriteCellData<>(value);  // 默认保持原值
        }
    }
}

